www.gusucode.com > seacms 海洋PHP影视视频网站建站系统 v6.61PHP源码程序 > seacms 海洋PHP影视视频网站建站系统 v6.61/海洋cms V6.61/海洋cms V6.61/upload/admin/editor/TQEditor.min.js

    (function(e,j){if(e.TQE)return;var v="2.3.8",o=navigator.userAgent.toLowerCase(),b=e.document,f=!!e.ActiveXObject||o.indexOf("trident")>=0,g=f&&!e.XMLHttpRequest,w=/msie ([0-9]+)/.exec(o),q=w!=null?parseInt(w[1]):0,n=o.indexOf("webkit")>=0,l=!n&&o.indexOf("gecko")>=0,K="\u6dfb\u52a0\u94fe\u63a5",r='<option value="">\u9ed8\u8ba4</option><option value="_blank">\u65b0\u7a97\u53e3</option><option value="_self">\u5f53\u524d\u7a97\u53e3</option><option value="_parent">\u7236\u7a97\u53e3</option><option value="_top">\u9876\u5c42\u7a97\u53e3</option>',D='\u7f51\u5740:<input type="text" id="url" value="" size=45 /><br />\u6807\u9898:<input type="text" id="title" value="" size=45 /><br />\u6253\u5f00:<select id="target">'+r+"</select>",H="\u63d2\u5165\u56fe\u7247",A='\u56fe\u7247\u7f51\u5740:<input type="text" id="url" value="" size=40 /><br />\u66ff\u6362\u6587\u672c:<input name="alt" type="text" id="alt" size="20" /><br />\u5c3a\u5bf8:<input name="width" type="text" id="width" size="4" /> &times; <input name="height" type="text" id="height" size="4" /> px &nbsp;<br />\u5bf9\u9f50:<select name="align" id="align"><option value="" >\u9ed8\u8ba4</option><option value="top">\u5c45\u4e0a</option><option value="textTop">\u6587\u672c\u4e0a\u65b9</option><option value="middle">\u5c45\u4e2d</option><option value="absMiddle">\u7edd\u5bf9\u5c45\u4e2d</option><option value="baseline">\u57fa\u7ebf</option><option value="bottom">\u5e95\u90e8</option><option value="absBottom">\u7edd\u5bf9\u5e95\u90e8</option><option value="left">\u5de6</option><option value="right">\u53f3</option></select> &nbsp; &nbsp; \u8fb9\u6846:<input name="border" type="text" id="border" size="5" />',x='<form class="ePopForm">\u7f51\u5740: <input type="text" id="url" size="50"><br>\u5c3a\u5bf8: <input  type="text" id="width" style="width:30px; overflow:visible;"> &times; <input  type="text" id="height" style="width:30px; overflow:visible;">px <a href="javascript:void(0)" id="resetWH" >\u91cd\u8bbe\u5927\u5c0f</a><label><input name="lock" type="checkbox" id="lock" value="1" checked>\u9501\u5b9a\u6bd4\u4f8b</label><br>\u66ff\u6362\u6587\u672c: <input type="text" id="alt" /> \u8fb9\u6846: <input type="text" id="border" style="width:30px; overflow:visible;" /><br>\u6392\u7248: <a href="javascript:void(0)" id="alignDefault">\u9ed8\u8ba4</a> | <a href="javascript:void(0)" id="alignLeft">\u5de6\u6d6e\u52a8</a> | <a href="javascript:void(0)" id="alignC">\u5c45\u4e2d</a> | <a href="javascript:void(0)" id="alignRight">\u53f3\u6d6e\u52a8</a> | <a href="javascript:void(0)" id="alignTop">\u4e0a\u5bf9\u9f50</a> | <a href="javascript:void(0)" id="alignAbsMiddle">\u4e2d\u5bf9\u9f50</a> | <a href="javascript:void(0)" id="alignBottom">\u4e0b\u5bf9\u9f50</a><div><hr>\u94fe\u63a5: <input type="text" id="link" size="40"><select id="target">'+r+"</select></div></form>",G="\u63d2\u5165\u52a8\u753b",z='Flash\u7f51\u5740:<input type="text" id="url" value="" size=40 /><br />\u5c3a\u5bf8:<input name="width" type="text" id="width" size="4" value="200" />&times;<input name="height" type="text" id="height" size="4" value="200" /> px',I="\u63d2\u5165\u97f3\u9891",B='\u97f3\u9891\u7f51\u5740:<input type="text" id="url" value="" size=40 /><br />\u81ea\u52a8\u64ad\u653e:<select id="auto_start" name="auto_start"><option value="0">\u624b\u52a8\u5f00\u59cb</option><option value="1">\u81ea\u52a8\u5f00\u59cb</option></select>',J="\u63d2\u5165\u89c6\u9891",C='\u89c6\u9891\u7f51\u5740:<input type="text" id="url" value="" size=40 /><br />\u5c3a\u5bf8:<input name="width" type="text" id="width" size="4"  value="320"/>&times;<input name="height" type="text" id="height" size="4" value="240" /> px<br />\u81ea\u52a8\u64ad\u653e:<select id="auto_start" name="auto_start"><option value="0">\u624b\u52a8\u5f00\u59cb</option><option value="1">\u81ea\u52a8\u5f00\u59cb</option></select><br />\u89c6\u9891\u7c7b\u578b:<select id="video_type" name="video_type"><option value="auto">\u81ea\u52a8\u8bc6\u522b</option><option value="flv">FLV</option><option value="rm">RMVB</option><option value="wm">\u5176\u4ed6\u89c6\u9891</option></select>',O="\u63d2\u5165\u884c",N="\u63d2\u5165\u5217",M="\u5220\u9664\u884c",L="\u5220\u9664\u5217",F="\u5220\u9664\u8868\u683c",y='<div><a class="eMenuItem" style="width:168px;" ><span id="eMergeCells" class="eButton"></span>\u5408\u5e76\u5355\u5143\u683c</a><a style="width:168px;" class="eMenuItem" ><span id="eSplitCells" class="eButton"></span>\u62c6\u5206\u5355\u5143\u683c</a><hr width="166"><div style="padding:1px 1px 1px 3px;">\u8868\u683c\u6392\u7248: <a id="eTableAlignLeft">\u5c45\u5de6</a> | <a id="eTableAlignCenter">\u5c45\u4e2d</a> | <a id="eTableAlignRight">\u5c45\u53f3</a></div><table border="0" cellSpacing="2" cellPadding="0"><tbody><tr><td width="65" align="center" valign="top" bgcolor="#FFFFFF" style="border:#999 solid 1px;">\u5185\u5bb9\u5bf9\u9f50<br><a id="eCellAlignLT" class="eButton eCellAlign"></a><a id="eCellAlignCT" class="eButton eCellAlign"></a><a id="eCellAlignRT" class="eButton eCellAlign"></a><br><a id="eCellAlignLC" class="eButton eCellAlign"></a><a id="eCellAlignCC" class="eButton eCellAlign"></a><a id="eCellAlignRC" class="eButton eCellAlign"></a><br><a id="eCellAlignLB" class="eButton eCellAlign"></a><a id="eCellAlignCB" class="eButton eCellAlign"></a><a id="eCellAlignRB" class="eButton eCellAlign"></a></td><td width="90" align="center" valign="top">\u5bbd\u5ea6<input id="width" name="width" size="3" type="text"><br>\u8fb9\u6846<input id="border" name="border" size="3" type="text"><br>\u95f4\u8ddd<input id="cellSpacing" name="cellSpacing" size="3" type="text"><br>\u586b\u5145<input id="cellPadding" name="cellPadding" size="3" type="text"></td></tr></tbody></table></div><div><hr width="166">\u63d2\u5165\u8868\u683c</div>',P="\u65e0\u8272",V="\u786e\u5b9a",S="\u53d6\u6d88",R="\u4e0a\u4f20",X="\u5173\u95ed",Q="\u7248\u672c",W="\u4f5c\u8005",U="\u5b98\u7f51",T="\u90ae\u7bb1",E="\u5206\u9875\u6807\u9898: ",a=function(t,m){var k=this,o=a.clone(a.config);k.objId=t;if(m){if(m.height&&m.height!="auto"){m.height=parseInt(m.height);if(isNaN(m.height))m.height="auto"}for(var u in m)o[u]=m[u]}if(typeof o.toolbar=="string"){var r=a.toolbarMode[o.toolbar];if(!r)r=a.toolbarMode.normal;o.toolbar=r.left;if(!m||j===m.toolbarRight)o.toolbarRight=r.right}k.config=o;k.hasFocus=false;k._containerDiv=null;k._toolbarDiv=null;k._clientDiv=null;k._statusDiv=null;k.init=function(){k.obj=a.find(k.objId);if(!k.obj){if(k.config.debug)throw"\u7f3a\u5c11ID\u4e3a "+k.objId+" \u8868\u5355\u5143\u7d20";return}if(k.obj.editor)return;k.obj.editor=k;if(!k.config.width||k.config.width=="auto")if(k.obj.style.width)k.config.width=k.obj.style.width;else if(k.obj.cols)k.config.width=k.obj.cols*8+"px";else k.config.width="100%";if(!k.config.height||k.config.height=="auto")if(k.obj.style.height)k.config.height=parseInt(k.obj.style.height,10);else if(k.obj.offsetHeight)k.config.height=k.obj.offsetHeight;else if(k.obj.rows)k.config.height=k.obj.rows*17;else k.config.height=200;var g,h,d,c='<div class="" id="'+k.objId+'_EditorToolBar">';c+='</div><div id="'+k.objId+'_EditorClient" class="eEditorClient"><iframe id="'+k.objId+'_Editor" style="height:'+k.config.height+'px;" frameborder=0 ></iframe></div><div class="eStatusBar"><div class="eResizeWH" ></div><div class="eResizeH" ></div></div>';if(!k.config.debug)k.obj.style.display="none";var b=a.CE("DIV","TQEditorContainer_"+k.objId,c);b.className="eEditor";b.style.width=k.config.width;k.obj.parentNode.insertBefore(b,k.obj);k._containerDiv=b;k._toolbarDiv=a.find(k.objId+"_EditorToolBar");k._clientDiv=a.find(k.objId+"_EditorClient");"function"===typeof k.config.oninit&&k.config.oninit.call(k);k._initContent(k.obj.value);k.changeToolbarMode(k.config.advToolbarMode,true);k.obj.focus=function(){this.editor.focus()};k._statusDiv=b.lastChild;if(false==k.config.resize)k._statusDiv.style.display="none";k._statusDiv.onmousedown=function(c){if(k._containerDiv.style.position=="absolute")return;var i,j,h,n,g=this,b=a.pos(this),m=a._docST(),l=a._docSL(),o=k.config.height,p=k._containerDiv.offsetWidth-2,d=this.style.cursor=="se-resize",s=a.pos(k._clientDiv).y;k._showTableContext(0);if(f){c=e.event;h=c.srcElement;i=l+c.clientX-b.x;j=m+c.clientY-b.y}else{h=c.target;i=c.pageX-b.x;j=c.pageY-b.y}d=d||h===g.firstChild&&"h"!=k.config.resize;g.mouseout=g.onmouseleave=null;var q=function(c){if(f){c=e.event;c.pageX=l+c.clientX;c.pageY=m+c.clientY}var g=s-a.pos(k._clientDiv).y,n=Math.max(50-o+b.y-g,c.pageY-j),h=Math.max(100-p+b.x,c.pageX-i);d&&k.setWidth(h-b.x+p);k.setHeight(n-b.y+o+g)},r=function(){k.focus();k._popTableContext()};n=a._draging(q,r,g);n.style.cursor=d?"se-resize":"s-resize"}};k._toobarCode=function(f,d){var c,e,b="";if(d.length){b+='<span class="eToolBarGroupRight" >';for(c=0;c<d.length;c++)b+=k._btnCode(d[c],false);b+="</span>"}b+='<span class="eToolBarGroup" >';if(k.config.showToolbarGroupHandle){e=a.toolbarBottons.group;b+='<div class="eButton eFirstToolBarGroup" id="eBTNgroup"  style="background-position: -'+e.left+"px 0;width:"+e.width+'px;" ></div>'}for(c=0;c<f.length;c++)b+=k._btnCode(f[c],true);b+='</span><div class="eClear"></div>';return b};k._btnCode=function(b,g){var f="",c,e,d;if("||"===b)b="group";else if("|"===b)b="separator";else if("string"!==typeof b){f='submenu="'+b.join(",")+'" ';b="submenu"}c=a.toolbarBottons[b];if(!c)return"";d=function(a){return'id="eBTN'+b+'" class="eButton"'+(a.css?' style="'+a.css+'"':"")};switch(b){case"group":if(!g)return"";e='</span><span class="eToolBarGroup" >';if(k.config.showToolbarGroupHandle)e+="<div "+d(c)+" ></div>";return e;case"separator":return"<div "+d(c)+" ></div>";case"br":return"<br />";default:return'<a href="javascript:void(0)" name="'+b+'" title="'+c.text+'" '+f+d(c)+" >"+c.text+"</a>"}};k._ieMouseStyle=function(c,e,d,h){if(!f||!g&&b.compatMode=="CSS1Compat")return;a.addListener(c,"mouseover",function(){this.className=d});a.addListener(c,"mouseup",function(){this.className=d});a.addListener(c,"mousedown",function(){this.className=h});a.addListener(c,"mouseout",function(){this.className=e})};k._keepBookmark=function(){if(f){var b,c=a.find(k.objId+"_Editor");a.addListener(c,"beforedeactivate",function(){b=k._getRange()});a.addListener(c,"activate",function(){if(null==b)return;var a=k._getSelection();if(a.addRange)a.addRange(b);else b.select();b=null})}};k._toolbarBottonClick=function(){var d=f?event:arguments[0],c=this.getAttribute("name"),b=a.toolbarBottons[c];d.cancelBubble=true;k.focus();if(b&&b.click)b.click(k,this);else{a.hidePop();k.exeCmd(c)}};k.__selectOption=function(b,c){for(var a=b.options.length-1;a>=0;a--)if(b.options[a].value==c){b.selectedIndex=a;return}};k.exeCmd=function(a,d){k.focus();var f=k.selectedCells(),c=k._getDoc(),b=k._getSelection(),e,g,h;if(f.length){g=c.createRange?c.createRange():c.body.createTextRange();for(e=0;e<f.length;e++){if("backcolor"==a||"hilitecolor"==a){f[e].style.backgroundColor=d;continue}if(b.empty)b.empty();else b.removeAllRanges&&b.removeAllRanges();if(b.selectAllChildren)b.selectAllChildren(f[e]);else if(g.moveToElementText){g.moveToElementText(f[e]);g.select()}try{c.execCommand(a,false,d!=null?d:false);if("bold"==a||"italic"==a||"underline"==a||"strikethrough"==a||"subscript"==a||"superscript"==a)if(e==0)h=c.queryCommandState(a);else h!=c.queryCommandState(a)&&c.execCommand(a,false,d!=null?d:false)}catch(i){}}if(b.empty)b.empty();else b.removeAllRanges&&b.removeAllRanges()}else try{return c.execCommand(a,false,d!=null?d:false)}catch(i){}};k.focus=function(){if(k.hasFocus)return;if("visual"==k.currentMode()){var c=k.selectedCells(),a,b;if(c.length<1){k._editorObj().contentWindow.focus();k._getDoc().body.setAttribute("contenteditable",true);var a=k._getRange(),b=k._getSelection();if(n&&b.rangeCount<1){a.selectNodeContents(k._getDoc().body);a.collapse(true);b.removeAllRanges();b.addRange(a)}}else{var a=k._getRange();if(a.select){a.collapse(false);a.select()}else{a.selectNodeContents(c[0]);a.collapse(false);b=k._getSelection();b.removeAllRanges();b.addRange(a)}}}else k._editorObj().focus();k.hasFocus=true};k.focusNode=function(){if("visual"!==k.currentMode()||!k.hasFocus)return null;var a,b=k._getSelection().focusNode;if(!b){a=k._getRange();return a.length?a.item(0).parentNode:a.parentElement?a.parentElement():null}return b};k._showColorSelectUI=function(d,c){var b=a.find(k.objId+"ColorSelect"+c);if(null==b){b=a.CE("DIV",k.objId+"ColorSelect"+c,a._colorPickerUI(),true);b.className="ePopPanel";a._noSel(b);a.listenTags(b,"TD","click",function(){a.hidePop();k.exeCmd(c,this.bgColor)});b.lastChild.lastChild.onclick=function(){a.hidePop();k.exeCmd(c,"")};a.listenTags(b,"TD","mouseover",function(){var a=this,c=e.setInterval(function(){a.style.backgroundColor=a.style.backgroundColor!=""?"":"#FFFFFF"},500),b=this.parentNode.parentNode.parentNode.parentNode.lastChild;b.firstChild.style.backgroundColor=this.bgColor;b.firstChild.nextSibling.innerHTML=this.bgColor;this.style.backgroundColor="#FFFFFF";this.onmouseout=function(){e.clearInterval(c);this.style.backgroundColor=""}})}a.pop(b,d)};k._popAsMenu=function(i,j){var l=i.getAttribute("name"),c=a.find(k.objId+"PopMenu"+l),h="",f,b,d,e;if(null==c){c=a.CE("DIV",k.objId+"PopMenu"+l,"",true);c.className="ePopPanel"}for(b=0;b<j.length;b++){d=j[b];if("separator"==d||"|"==d){h+='<hr style="width:120px; clear:both;" />';continue}e=a.toolbarBottons[d];if(e)h+='<div  name="'+d+'" class="eMenuItem" ><span class="eButton" id="eBTN'+d+'" ></span>'+e.text+"</div>"}c.innerHTML=h;a._noSel(c);a.listenTags(c,"DIV","click",k._toolbarBottonClick);if(g){f=a._tags(c,"DIV");for(b=f.length-1;b>=0;b--)k._ieMouseStyle(f[b],"eMenuItem","eMenuItemUp","eMenuItem")}a.pop(c,i)};k._popFormUI=function(t,q,s,r,e,b,n,o,p){var c='<form class="ePopForm">';if(b){c+='<div class="eTabBar"><a href="javascript:void(0)" class="active" HIDEFOCUS="true">'+q+'</a><a href="javascript:void(0)" HIDEFOCUS="true">'+R+"</a></div>";c+="<div>"}c+=s;c+='<div class="eBar"><button id="OK" name="OK" type="submit" class="eBtn"  HIDEFOCUS="true"/>'+V+'</button> &nbsp; <button id="Cancel" name="Cancel" type="button" class="eBtn"  HIDEFOCUS="true">'+S+"</button></div>";if(b){c+='</div><div style="display:none">';var f=b;if(b.substr(0,1)=="#")f=b.substring(1);else{if(!("http://"==b.substr(0,7).toLowerCase()||"/"==b.substr(0,1)||"https://"==b.substr(0,6).toLowerCase()))if("?"==b.substr(0,1))b=location.pathname+b;else{var h=location.pathname.split("/");h[h.length-1]=b;b=h.join("/")}f=a.url+"upload.htm?url="+encodeURIComponent(b)+"&field_name="+k.config.uploadFieldName+"&exts="+encodeURIComponent(n)+"&max_size="+encodeURIComponent(o)+"&debug="+k.config.debug+"&upload_type="+p}c+='<iframe src="'+f+'" frameborder=0 width=358 height=45 ALLOWTRANSPARENCY=true marginwidth=0 marginheight=0 ></iframe>';c+="</div>"}c+="</form>";var d=a.CE("DIV",t,c,true);d.className="ePopPanel";if(b){var l=function(){this.className="active";var a=this.parentNode.nextSibling;if(this.nextSibling){this.nextSibling.className="";a.style.display="";a.nextSibling.style.display="none";a.parentNode.getElementsByTagName("INPUT")[0].focus()}else if(this.previousSibling){this.previousSibling.className="";a.style.display="none";a.nextSibling.style.display=""}},m=d.firstChild.firstChild;m.firstChild.onclick=l;m.lastChild.onclick=l}var j=a._tags(d,"FORM")[0],g=j.elements;j.srcEditor=k;g.Cancel.onclick=a.hidePop;g.OK.onclick=r;j.onsubmit=function(){this.elements.OK.click();return false};if(e)for(i=e.length-1;i>=0;i--)k._intEdit(g[e[i]]);a._noSel(d);return d};k.insertMusic=function(b,a){var c=k.config.tplMusic.replace(/\{\$url\}/g,b).replace(/\{\$auto_start\}/g,a);k.insertHtml(c)};k.insertFlash=function(d,c,b){var a=k.config.tplFlash.replace(/\{\$url\}/g,d);a=a.replace(/\{\$width\}/g,c);a=a.replace(/\{\$height\}/g,b);k.insertHtml(a)};k.insertVideo=function(c,d,g,f,e){var a="",b;switch(e){case"rm":a=k.config.tplRm;break;case"flv":a=k.config.tplFlv;break;case"wm":a=k.config.tplVideo;break;default:b=c.substr(c.lastIndexOf(".")).toLowerCase();if(".flv"==b)a=k.config.tplFlv;else if(".rm"==b||".rmvb"==b)a=k.config.tplRm;else a=k.config.tplVideo}a=a.replace(/\{\$url\}/g,c).replace(/\{\$auto_start\}/g,d).replace(/\{\$width\}/g,g).replace(/\{\$height\}/g,f);k.insertHtml(a)};k.insertHtml=function(e,d){k.focus();if("code"==k.currentMode()){var f=k._editorObj();if(b.selection){var c=b.selection.createRange();if("before"==d||-1==d)c.text=e+c.text;else if("after"==d||1==d)c.text+=e;else c.text=e;c.select()}else if(f.selectionStart||f.selectionStart=="0"){var j=f.selectionStart,m=f.selectionEnd,p=f.scrollTop,h=f.value;if("before"==d||-1==d)e=h.substring(j,m)+e;else if("after"==d||1==d)e+=h.substring(j,m);f.value=h.substr(0,j)+e+h.substr(m,h.length);f.focus();f.selectionStart=f.selectionEnd=j+e.length;f.scrollTop=p}else{f.value+=e;f.focus()}k.save();return}if(l)e=e.replace(/<td([^>]*)>\s*<\/td/ig,"<td$1 ><br></td");var c=k._getRange();if(c.length){var q=k._getDoc(),r=c.item(0),i=q.body.createTextRange();i.moveToElementText(r);if("before"==d||-1==d)i.collapse();else if("after"==d||1==d)i.collapse(false);else c.execCommand("Delete");i.pasteHTML(e);i.select()}else if(c.insertNode){var g,o,n;if(c.createContextualFragment)g=c.createContextualFragment(e);else{g=k._getDoc().createDocumentFragment();g.appendChild(a.CE("div"));g.firstChild.outerHTML=e}if("before"==d||-1==d){o=g.lastChild;c.insertNode(g);c.setEndAfter(o)}else if("after"==d||1==d){c.collapse(false);c.insertNode(g)}else{c.deleteContents();c.insertNode(g)}c.collapse(false);n=k._getSelection();n.removeAllRanges();n.addRange(c)}else{if("before"==d||-1==d)c.collapse(true);else("after"==d||1==d)&&c.collapse(false);c.pasteHTML(e);c.collapse(false);c.select()}k.save()};k.appendHtml=function(a){k.unselectAllCells();k.setContent(k.content()+a)};k._editorObj=function(){return a.find(k.objId+"_Editor")};k.currentMode=function(){return k._editorObj().tagName.toUpperCase()==="IFRAME"?"visual":"code"};k._getDoc=function(){var a=k._editorObj();return a.contentDocument||a.contentWindow.document};k._getSelection=function(){var a=k._editorObj().contentWindow;return a.getSelection?a.getSelection():k._getDoc().selection};k._getRange=function(){var a=k._getSelection(),c=k._getDoc(),b;try{b=a.rangeCount>0?a.getRangeAt(0):a.createRange?a.createRange():c.createRange()}catch(d){}if(!b)b=f?c.body.createTextRange():c.createRange();return b};k.insertImage=function(g,c,b,d,f,e){if(""==g)return;var a='<img src="'+g+'" ';if(c!==j&&""!=c&&!isNaN(parseInt(c))&&parseInt(c)>0)a+=" width="+parseInt(c);if(b!==j&&""!=b&&!isNaN(parseInt(b))&&parseInt(b)>0)a+=" height="+parseInt(b);if(d!==j&&""!=d&&!isNaN(parseInt(d)))a+=" border="+parseInt(d);if(f!==j&&""!=f)a+=' alt="'+f+'"';if(e!==j&&""!=e)a+=' align="'+e+'"';a+=" />";k.insertHtml(a);return};k._enableButton=function(b,c){if(b.disabled===j)b.disabled=false;if(b.disabled!=c)return;if(c){b.disabled=false;k.setOpacity(b,100);a.addListener(b,"click",k._toolbarBottonClick)}else{b.disabled=true;k.setOpacity(b,30);a.delListener(b,"click",k._toolbarBottonClick)}};k._updateToolbar=function(g,f,e){var h=k._toolbarDiv,d=k._button("mode"),c=a._tags(h,"A"),b;if(d)d.id="visual"===k.currentMode()?"eBTNmode":"eBTNmode-reset";for(b=c.length-1;b>=0;b--)k.inArray(c[b].getAttribute("name"),f)^e&&k._enableButton(c[b],g)};k._hook=function(){var c=k._getDoc();c.onkeydown=function(g){a._hideContext();if(f)g=k._realEvent(g);var h=g.keyCode||g.which;g.ctrlKey&&(13==h||10==h||83==h)&&k.save();var o=k._call("keydown",g);if(j!==o&&false==o)return false;(8==h||46==h)&&k.selectedCells().length&&k.exeCmd("delete");if(h==13){var c=k.focusNode(),m,i,e,n;if(!c)return;if(c.nodeName==="#text")c=c.parentNode;if(c.className=="splitPage"){m=c.parentNode;if(c.nextSibling&&c.nextSibling.nodeName==="BR")i=c.nextSibling;else{i=b.createElement("BR");if(m.lastChild==c)m.appendChild(i);else m.insertBefore(i,c.nextSibling)}n=k._getDoc();if(f){e=n.body.createTextRange();e.moveToElementText(i);e.collapse(true);e.select()}else{e=n.createRange();e.selectNode(i);e.collapse(true);var p=k._getSelection();p.removeAllRanges();p.addRange(e)}return false}if(k.config.enter2br){if(c.tagName!="LI"){k.insertHtml("<br />","before");!f&&null==c.nextSibling&&k.insertHtml("<br />","before");return false}}else if(!f&&!g.shiftKey){for(var o=k._getRange(),d,l=o.startContainer;l;l=l.parentNode){d=l.nodeName;if(d=="LI"||d=="P"||"H1"==d||"H2"==d||"H3"==d||"H4"==d||"H5"==d||"H6"==d||"DIV"==d)return true}k.exeCmd("FormatBlock","p")}}};c.onkeyup=function(b){b=k._realEvent(b);var e=b.keyCode||b.which,d=this.body.firstChild;if((8===e||46===e)&&d&&d===c.body.lastChild){var a=d.nodeName,f=d.innerHTML,g=/^<(strong|em|b|i|u|font)[^>]*><\/\1>|&nbsp;$/i;if(a==="P"||a==="H1"||a==="H2"||a==="H3"||a==="H4"||a==="H5"||a==="H6"||a==="BR")if(""===f||g.test(f))c.body.innerHTML=""}k._call("keyup",b)};c.ondragstart=function(){a._hideContext();k._showTableContext(0)};c.onclick=function(c){var b,e,d;a._hideContext();if(!f){b=c.target;if("IMG"===b.nodeName){e=k._getDoc().createRange();d=k._getSelection();e.selectNode(c.target);d.removeAllRanges();d.addRange(e);k._popImagePanel(b)}}else{c=k._realEvent(c);b=c.srcElement;"IMG"===b.nodeName&&k._popImagePanel(b)}};if(f){c.onmousedown=c.onclick;c.onclick=null}c.body.onpaste=function(a){if(f)a=k._realEvent(a);var b=k._call("paste",a);k.config.autoClean&&setTimeout(k.cleanWord,200)};a.addListener(c,"mouseup",a.hidePop);a.addListener(c,"scroll",k._popTableContext);a.addListener(c.body,"scroll",k._popTableContext);a.addListener(c,"keyup",k._popTableContext);a.addListener(c,"mouseup",k._popTableContext);a.addListener(c,"mousedown",k._startSelectTd);a.addListener(c,"keypress",k.unselectAllCells);if(g){a.addListener(c,"mouseup",k.focus);a.addListener(c,"mousedown",k.focus)}};k._popImagePanel=function(c){if(!k.config.autoPopImagePanel)return;var b=a.find("__tqImagePanel");if(null==b){b=a.CE("DIV","__tqImagePanel",x,true);b.className="ePopPanel";var j=a._tags(b,"FORM")[0],d=j.elements;k._intEdit(d.width);k._intEdit(d.height);k._intEdit(d.border);b.urlField=d.url;b.widthField=d.width;b.heightField=d.height;b.lockField=d.lock;b.borderField=d.border;b.altField=d.alt;b.linkField=d.link;b.targetField=d.target;b.linkField.onchange=function(){var c=this.parentNode.parentNode.parentNode,b=c.target,a=b.parentNode;if(a.nodeName!=="A")return;a.setAttribute("href",this.value)};b.targetField.onchange=function(){var c=this.parentNode.parentNode.parentNode,b=c.target,a=b.parentNode;if(a.nodeName!=="A")return;a.setAttribute("target",this.options[this.selectedIndex].value)};b.urlField.onchange=function(){this.parentNode.parentNode.target.src=this.value};b.urlField.onfocus=function(){this.select()};var i=function(){var a=this.parentNode.parentNode,b=a.target,c=h=Math.max(1,this.value);if(a.lockField.checked)if(this.id=="width")h=a.heightField.value=Math.round(c/a.rate);else c=a.widthField.value=Math.round(h*a.rate);else if(this.id=="width")h=a.heightField.value;else c=a.widthField.value;b.width=c;b.height=h;b.style.width="";b.style.height=""};b.widthField.onchange=b.widthField.onblur=b.heightField.onchange=b.heightField.onblur=i;b.borderField.onchange=function(){var a=this.parentNode.parentNode.target;if(""===this.value)a.removeAttribute("border");else a.border=this.value};b.altField.onchange=function(){var a=this.parentNode.parentNode.target;if(""===this.value)a.removeAttribute("alt");else a.alt=this.value};b.lockField.onclick=function(){if(this.checked){var a=this.parentNode.parentNode.parentNode;a.rate=a.widthField.value/a.heightField.value}};for(var g=function(){var c=this.parentNode.parentNode,a=c.target,b=this.id;if("resetWH"==b){a.removeAttribute("width");a.removeAttribute("height");a.style.width="";a.style.height="";c.widthField.value=a.width;c.heightField.value=a.height;c.rate=a.width/a.height}else{a.align="";a.style.display="";a.style.margin="";k.exeCmd("justifynone");if("alignC"==b)k.exeCmd("justifycenter");else if("alignDefault"!=b)a.align=b.substring(5,20).toLowerCase()}return false},f=a._tags(b,"A"),e=f.length-1;e>=0;e--)f[e].onclick=g;a._noSel(b)}if(c.parentNode&&c.parentNode.nodeName==="A"){b.lastChild.lastChild.style.display="";b.linkField.value=c.parentNode.getAttribute("href");k.__selectOption(b.targetField,c.parentNode.getAttribute("target"))}else{b.lastChild.lastChild.style.display="none";b.linkField.value="";b.targetField.selectedIndex=0}b.target=c;b.urlField.value=c.getAttribute("src");b.widthField.value=c.width;b.heightField.value=c.height;b.borderField.value=c.border;b.altField.value=c.alt;b.rate=c.width>0&&c.height>0?c.width/c.height:1;k._popContext(b,c)};k._popContext=function(b,g){a.activeContext!=b&&a._hideContext();var f,c,e;p=a.pos(k._editorObj()),p2=g.getBoundingClientRect(),d=a._doc();b.style.display="block";f=Math.min(p.x+p2.left,a._docSL()+d.clientWidth-b.offsetWidth-5);c=Math.min(p.y+p.height,10+p.y+p2.bottom);e=a._docST()+d.clientHeight-b.offsetHeight-10;if(c>e)c=Math.max(p.y-b.offsetHeight,p.y+p2.top-b.offsetHeight-10);b.style.left=f+"px";b.style.top=c+"px";a.activeContext=b;a.drag(b)};k._showTableContext=function(e){for(var b,d=["TQEAddRowBefore","TQEAddRowAfter","TQEAddColBefore","TQEAddColAfter","TQEDeleteRow","TQEDeleteColumn","TQEDeleteTable"],c=d.length;c>=0;c--){b=a.find(d[c]);if(b)b.style.display=e?"":"none"}};k._popTableContext=function(){if(!k.config.autoPopTablePanel)return;var m,b=k.focusNode();while(b&&b.nodeName!=="TD")b=b.parentNode;if(!b)return k._showTableContext(0);m=b.parentNode.parentNode.parentNode;var l=a.pos(k._editorObj()),p=m.getBoundingClientRect(),e=b.getBoundingClientRect(),c=a.find("TQEAddRowBefore"),h=a.find("TQEAddRowAfter"),f=a.find("TQEAddColBefore"),d=a.find("TQEAddColAfter"),j=a.find("TQEDeleteRow"),g=a.find("TQEDeleteColumn"),i=a.find("TQEDeleteTable"),q=k._getDoc().documentElement,n,o;if(e.top+b.offsetHeight<0||e.left+b.offsetWidth<0||e.top>=q.clientHeight||e.left>=q.clientWidth)return k._showTableContext(0);if(!c){i=a.CE("A","TQEDeleteTable","",true);i.title=F;c=a.CE("A","TQEAddRowBefore","",true);h=a.CE("A","TQEAddRowAfter","",true);h.className=c.className="eButtonAddRow";c.title=h.title=O;f=a.CE("A","TQEAddColBefore","",true);d=a.CE("A","TQEAddColAfter","",true);d.className=f.className="eButtonAddCol";f.title=d.title=N;j=a.CE("A","TQEDeleteRow","",true);g=a.CE("A","TQEDeleteColumn","",true);g.className=j.className=i.className="eButtonDeleteRC";j.title=M;g.title=L;a._noSel(c);a._noSel(h);a._noSel(f);a._noSel(d);a._noSel(j);a._noSel(g);a._noSel(i);c.onclick=h.onclick=f.onclick=d.onclick=j.onclick=g.onclick=i.onclick=function(){if(!this.cell)return;var b=this.cell,d=b.parentNode.parentNode.parentNode,c=this.editor;c.unselectAllCells();switch(this.id){case"TQEAddRowBefore":a.insertRow(b,1);break;case"TQEAddRowAfter":a.insertRow(b,0);break;case"TQEAddColBefore":a.insertCol(b,1);break;case"TQEAddColAfter":a.insertCol(b,0);break;case"TQEDeleteRow":a.deleteRow(b);break;case"TQEDeleteColumn":a.deleteCol(b);break;case"TQEDeleteTable":d.parentNode.removeChild(d)}c.focus();c._popTableContext()}}else k._showTableContext(1);c.cell=h.cell=f.cell=d.cell=j.cell=g.cell=i.cell=b;c.editor=h.editor=f.editor=d.editor=j.editor=g.editor=i.editor=k;h.style.left=c.style.left=j.style.left=Math.min(l.x+k._getDoc().body.offsetWidth-12,l.x+p.left+m.offsetWidth)+"px";c.style.top=l.y+e.top-5+"px";h.style.top=l.y+e.top+b.offsetHeight-4+"px";j.style.top=l.y+e.top+(b.offsetHeight>>>1)-6+"px";d.style.top=f.style.top=g.style.top=l.y+Math.max(0,p.top-12)+"px";f.style.left=l.x+e.left-5+"px";d.style.left=l.x+e.left+b.offsetWidth-5+"px";g.style.left=l.x+e.left+(b.offsetWidth>>1)-6+"px";n=a.pos(c);o=a.pos(d);i.style.top=Math.min(o.y,n.y-13)+"px";i.style.left=Math.max(o.x+10,n.x)+"px"};k.activeTable=null;k.unselectAllCells=function(){if(!k.activeTable)return;try{for(var d=k.activeTable,c,b=d.rows.length-1;b>=0;b--)for(c=d.rows[b].cells.length-1;c>=0;c--){td=d.rows[b].cells[c];p=a.pos(td);k._selectCell(td,false)}}catch(e){}k.activeTable=null};k.selectedCells=function(){if(!k.activeTable)return[];try{for(var c=k.activeTable,b,d=[],a=c.rows.length-1;a>=0;a--)for(b=c.rows[a].cells.length-1;b>=0;b--)c.rows[a].cells[b].isSelected&&d.push(c.rows[a].cells[b])}catch(e){}return d};k._selectCell=function(a,b){if(a.isSelected==b)return;a.className=b?"selectedTD":"";a.isSelected=b};k._pos=function(d){var e=0,f=0,g=d.getBoundingClientRect(),c=k._getDoc(),b=k._editorObj().contentWindow,a=c.compatMode!="CSS1Compat"?c.body:c.documentElement;e=g.left-a.clientLeft+(b.scrollX?b.scrollX:a.scrollLeft);f=g.top-a.clientTop+(b.scrollY?b.scrollY:a.scrollTop);return{x:e,y:f,left:e,top:f,width:d.offsetWidth,height:d.offsetHeight}};k._startSelectTd=function(c){var u,v,l,m,h,t,s,r,g,d,i=false,a=k._getDoc(),e=a.parentWindow,j=a.compatMode!="CSS1Compat"?a.body:a.documentElement,p=a.onmousemove,q=a.onmouseup,o=a.ondragstart,n=b.onmouseup;c=k._realEvent(c);if(c.ctrlKey||c.altKey||c.button!=f?1:0)return;k.unselectAllCells();d=f?c.srcElement:c.target;while(d&&d.nodeName!="BODY"&&d.nodeName!="TD")d=d.parentNode;if(!d||d.nodeName!=="TD")return;h=d.parentNode.parentNode.parentNode;if(h.nodeName!=="TABLE")return;g=k._pos(d);l=f?c.clientX+(e.scrollX?e.scrollX:j.scrollLeft):c.pageX;m=f?c.clientY+(e.scrollY?e.scrollY:j.scrollTop):c.pageY;a.onmousemove=function(d){var b,c,v,w,o,p,r,s,t,u,a,q,n;if(f){d=this.parentWindow.event;b=d.clientX+(e.scrollX?e.scrollX:j.scrollLeft);c=d.clientY+(e.scrollY?e.scrollY:j.scrollTop)}else{b=d.pageX;c=d.pageY}if(!i&&(b<g.x||b>g.x+g.width||c<g.y||c>g.y+g.height)){i=true;k.activeTable=h}if(!i)return;n=k._getSelection();if(n.empty)n.empty();else n.removeAllRanges&&n.removeAllRanges();r=Math.min(l,b);s=Math.max(l,b);t=Math.min(m,c);u=Math.max(m,c);for(o=h.rows.length-1;o>=0;o--)for(p=h.rows[o].cells.length-1;p>=0;p--){q=h.rows[o].cells[p];a=k._pos(q);k._selectCell(q,a.x<=s&&a.y<=u&&a.x+a.width>=r&&a.y+a.height>t)}};a.ondragstart=a.onmouseup=b.onmouseup=function(){a.onmousemove=p;a.ondragstart=o,b.onmouseup=n;i=false}};k.canMergeSelectedCells=function(){if(!k.activeTable)return false;var f=k.activeTable,b,g,h,j,i,e,m,d,l=0,c=k.selectedCells();if(c.length<2)return false;a.updateCellsStatus(f);h=c[0].colStart;i=c[0].colEnd;j=c[0].rowStart;e=c[0].rowEnd;for(b=c.length-1;b>0;b--){h=Math.min(h,c[b].colStart);j=Math.min(j,c[b].rowStart);i=Math.max(i,c[b].colEnd);e=Math.max(e,c[b].rowEnd)}for(b=Math.min(e,f.rows.length-1);b>=0;b--)for(g=f.rows[b].cells.length-1;g>=0;g--){d=f.rows[b].cells[g];if(!d.isSelected&&d.colStart<=i&&d.colEnd>=h&&d.rowStart<=e&&d.rowEnd>=j)return false}return true};k.mergeSelectedCells=function(){if(!k.canMergeSelectedCells())return false;for(var g=k.activeTable,e,j,m,b,l="",f=null,i=1,h=1,c,d=0;d<g.rows.length;d++)for(e=0;e<g.rows[d].cells.length;e++)if(g.rows[d].cells[e].isSelected){c=g.rows[d].cells[e];l+=c.innerHTML;b=a.pos(c);if(f===null){f=c;j=b.x;m=b.y;i=f.rowSpan;h=f.colSpan}else{if(b.y===m)h+=c.colSpan;else if(b.x===j)i+=c.rowSpan;c.innerHTML=""}}f.innerHTML=l.replace(/(&nbsp;|<br\s*\/?>)+$/,"$1");f.rowSpan=i;f.colSpan=h;for(d=g.rows.length-1;d>=0;d--){b=g.rows[d];for(e=b.cells.length-1;e>=0;e--)if(b.cells[e].isSelected){c=b.cells[e];c!=f&&b.removeChild(c)}b.cells.length<1&&g.deleteRow(d)}a.updateCellsStatus(g)};k.splitCell=function(b){if(!b||b.rowSpan<2&&b.colSpan<2)return true;var h=b.parentNode.parentNode.parentNode,c,d,g,e,f;a.updateCellsStatus(h);for(c=b.rowStart;c<=b.rowEnd;c++){e=h.rows[c];for(d=0;d<e.cells.length;d++)if(e.cells[d].colStart>b.colEnd)break;g=b.colSpan;if(c==b.rowStart)g--;while(0<g--){f=e.insertCell(d);k._selectCell(f,b.isSelected);f.style.backgroundColor=b.style.backgroundColor}}b.rowSpan=1;b.colSpan=1};k._changed=function(){k._autoSave(1);k._showTableContext(false);var b;if("visual"===k.currentMode()){k._keepBookmark();k._hook();b=k._editorObj().contentWindow;a.addListener(b,"resize",k._popTableContext);if(g)b=b.document.body}else{b=k._editorObj();a.addListener(b,"mouseup",a.hidePop);b.onkeydown=function(a){return k._call("keydown",a)};b.onkeyup=function(a){return k._call("keyup",a)}}b.onfocus=function(a){k.hasFocus=true;k.obj.onfocus&&k.obj.onfocus();k._call("focus",a)};b.onblur=function(a){k.hasFocus=false;k.obj.onblur&&k.obj.onblur();k._call("blur",a)}};k._realEvent=function(a){if(f)a="code"===k.currentMode()?e.event:k._editorObj().contentWindow.event;return a};k._call=function(b,c){var a=k.config["on"+b];if("function"===typeof a)return a.call(k,k._realEvent(c))};k.changeMode=function(c){var e=k.currentMode();if(e===c)return;if(!c)c="code"!=e?"code":"visual";if(c==e)return;k.hasFocus=false;var i=k._editorObj(),f=1+i.offsetHeight,d,g="visual"===c;if("code"===c){k.unselectAllCells();f-=4;d='<table width=100% border=0 cellpadding=0 cellspacing=0><tr><td width=2 style="padding:0"></td><td style="padding:0"><textarea id="'+k.objId+'_Editor" wrap="hard" style="height:'+f+'px"></textarea></td></tr></table>'}else if(g)d='<IFRAME id="'+k.objId+'_Editor" frameborder=0 marginheight=0 marginwidth=0 style="height:'+f+'px" ></IFRAME>';else return;k._autoSave(0);a._hideContext();var h=k.content();b.body.appendChild(k._clientDiv);k._clientDiv.innerHTML=d;k._containerDiv.insertBefore(k._clientDiv,k._containerDiv.lastChild);k._initContent(h);k._updateToolbar(g,["toolbarmode","mode","fullscreen","help"],true)};k.typeset=function(){if("visual"!=k.currentMode())return;k._showTableContext(0);var g=k._getDoc(),b,d,h,f,e,l;h=g.body.innerHTML;h=h.replace(/&nbsp;/gi," ").replace(/>\s+</gm,"> <").replace(/ +/gi," ").replace(/<div/gi,"<p").replace(/<\/div/gi,"</p");g.body.innerHTML=h;d=a._tags(g,"CENTER");for(i=d.length-1;i>=0;i--)a.removeNode(d[i],false);d=a._tags(g,"SPAN");for(i=d.length-1;i>=0;i--){b=d[i];l=b.style.fontWeight,c=b.style.color;if(""===b.innerHTML.replace(/<[a-z\/][^>]*>/gi,"")||l==""&&c==""){a.removeNode(b,false);continue}b.removeAttribute("style");b.className="";b.removeAttribute("class");b.style.fontWeight=l;b.style.color=c}d=a._tags(g,"H3");for(i=d.length-1;i>=0;i--)if(d[i].className==="splitPage")d[i].innerHTML=d[i].innerHTML.replace(/<\/?[a-zA-z][^>]*>/g,"");d=a._tags(g,"P");var n=/^(&nbsp;| ){3,}/;for(i=d.length-1;i>=0;i--){b=d[i];if(""==b.innerHTML.replace(/<[a-z\/][^>]*>/gi,"").replace(/( |\n|\r|\t|&nbsp;)/gi,"")){a.removeNode(b,false);continue}b.removeAttribute("style");b.className="";b.removeAttribute("class");if(n.test(b.innerHTML))b.align="center";else{b.removeAttribute("align");b.style.textIndent=k.config.typesetIndentParagraph?"2em":""}}d=a._tags(g,"A");for(i=d.length-1;i>=0;i--){b=d[i];if(""==b.innerHTML.replace(/<[a-z\/][^>]*>/gi,"").replace(/( |\n|\r|\t|&nbsp;)/gi,"")){a.removeNode(b,false);continue}b.removeAttribute("style");b.className="";b.removeAttribute("class")}var m=function(a){var b=a.nodeName,c=/^( |\n|\r|\t|&nbsp;)*$/gi;return b==="#text"?c.test(a.nodeValue):"BR"===b||"IMG"!==b&&""==a.innerHTML.replace(/<[a-z\/][^>]*>/gi,"").replace(/(\s|&nbsp;)/gmi,"")},j=function(c){var b,d;while(c&&c.tagName!="BODY"){b=c;while(b=b.nextSibling){if(m(b))continue;if(b.nodeName==="#text"){f=a.CE("CENTER","",b.nodeValue);c.parentNode.insertBefore(f,b);a.removeNode(b,true);return}else{if(b.tagName=="CENTER")return;if(b.tagName=="P")b.align="center";else b.style.textAlign="center";return}}c=c.parentNode}};d=a._tags(g,"IMG");for(i=d.length-1;i>=0;i--){b=d[i];if(b.getAttribute("emot"))continue;k.config.typesetImageTextCenter&&j(b);b.removeAttribute("style");b.border=k.config.typesetImageBorder?"1":"0";b.style.margin="5px";e=b.parentNode;if(e.tagName=="A"&&e.firstChild==e.lastChild){b=e;e=e.parentNode}if(e.tagName=="P"&&e.align=="center"||e.tagName=="CENTER"||e.style.textAlign=="center")continue;f=a.CE("CENTER");e.insertBefore(f,b);f.appendChild(b)}d=a._tags(g,"OBJECT");for(i=d.length-1;i>=0;i--){b=d[i];k.config.typesetImageTextCenter&&j(b);e=b.parentNode;if(e.tagName=="P"&&e.align=="center"||e.tagName=="CENTER"||e.style.textAlign=="center")continue;f=a.CE("CENTER");e.insertBefore(f,b);f.appendChild(b)}d=a._tags(g,"EMBED");for(i=d.length-1;i>=0;i--){b=d[i];if("OBJECT"===b.parentNode.tagName)continue;k.config.typesetImageTextCenter&&j(b);e=b.parentNode;if(e.tagName=="P"&&e.align=="center"||e.tagName=="CENTER"||e.style.textAlign=="center")continue;f=a.CE("CENTER");e.insertBefore(f,b);f.appendChild(b)}k.cleanWord(true)};k.cleanWord=function(f){if("visual"!=k.currentMode())return;var b=k._getDoc(),d;if(!f){d=b.body.innerHTML;if(d.indexOf("mso")<0&&d.search(/[a-z]+:[a-z0-9]+="[^\"]*"/ig)<0)return}var c=function(i,h){for(var d,f,c,e,g=i.length-1;g>=0;g--){f=a._tags(b,i[g]);for(e=f.length-1;e>=0;e--){d=f[e];d.removeAttribute("lang");c=d.getAttribute("style");if(null==c&&h){a.removeNode(d,false);continue}if(typeof c=="string"&&c.indexOf("mso-")>=0){c+=";";c=c.replace(/mso\-[^;]+?;/gi,"").replace(/FONT\-FAMILY[^;]+?;/gi,"").replace(/\s+/g," ").replace(/MARGIN\: 0cm 0cm 0pt;/gi,"").replace(/tab\-stops\:[^;]+?;/gi,"");if(""==c||" "==c){if(h){a.removeNode(d,false);continue}d.removeAttribute("style")}else d.setAttribute("style",c)}c=d.getAttribute("class");if(null!=c){c=c.replace(/mso[a-z\-]+\s*/gi,"").replace(/^xl[0-9]+$/i,"");if(""==c)d.removeAttribute("class");else d.setAttribute("class",c)}}}},e=function(g){for(var e,d,h,c,f=g.length-1;f>=0;f--){d=a._tags(b,g[f]);for(c=d.length-1;c>=0;c--){e=d[c];e.innerHTML==""&&a.removeNode(e,false)}}};c(["SPAN"],true);c(["P","B","I","U","TD","TR","TABLE","DIV","COL","FONT"],false);b.body.innerHTML=b.body.innerHTML.replace(/<o:[a-z0-9_]+[^>]*>/gi,"").replace(/<\/o:[a-z0-9_]+>/gi,"").replace(/<\?xml.+?\/>/gi,"").replace(/(<[a-z]+[^>]+>)/ig,function(b,a){if(a.indexOf(":")>0)a=a.replace(/[a-z]+:[a-z0-9]+="[^\"]*"/ig,"");return a});c(["SPAN"],true);e(["SPAN","FONT","B","U","I","STRONG","EM"]);k.save()};k.setWidth=function(a){if(a>1)k.config.width=a+"px";else k.config.width=a*100+"%";k._containerDiv.style.width=k.config.width};k.setHeight=function(a){if(a<9)a=9;k.config.height=a;k._setHeight(a)};k._setHeight=function(a){if(a<2)a=2;k._editorObj().style.height=a+"px";if("visual"==k.currentMode()){a-=6;if(a<2)a=2;k._getDoc().body.style.minHeight=a+"px";if(g)k._getDoc().body.style.height=a+"px"}};k._fixFull=function(){var c=a._doc(),b=k._containerDiv,d;b.style.zIndex="10000";b.style.width=c.clientWidth+"px";if(g){b.style.top=a._docST()+"px";b.style.left=a._docSL()+"px"}d=c.clientHeight-k._toolbarDiv.offsetHeight;k._setHeight(d-("visual"==k.currentMode()?2:6))};k._button=function(d){for(var c=a._tags(k._toolbarDiv,"A"),b=c.length-1;b>=0;b--)if(d==c[b].getAttribute("name"))return c[b];return null};k.changeToolbarMode=function(m,n){var c=k._toolbarDiv,e,d,o=c.offsetHeight;if(m===j||null===m)m=c.className=="eToolBar"?true:false;else if(n===j||!n)if(m==(c.className!="eToolBar"))return;if(m){c.className="eToolBar eLargeIcons";b.body.appendChild(c);c.innerHTML=k._toobarCode(k.config.advToolbar,k.config.advToolbarRight)}else{c.className="eToolBar";b.body.appendChild(c);c.innerHTML=k._toobarCode(k.config.toolbar,k.config.toolbarRight)}k._containerDiv.insertBefore(c,k._containerDiv.firstChild);if(f&&q<9){var l=a._tags(c,"SPAN"),h=0,i=0;for(d=l.length-1;d>=0;d--){l[d].style.width=l[d].offsetWidth+2+"px";e=a._tags(l[d],"A");h=0;for(i=e.length-1;i>=0;i--)if(e[i].offsetLeft+e[i].offsetWidth>h)h=e[i].offsetLeft+e[i].offsetWidth;h-=l[d].offsetLeft-2;if(h>0)l[d].style.width=h+"px"}}if(o){k.setHeight(k.config.height+o-c.offsetHeight);var p=g?"position":"fixed";k._containerDiv.style.position==p&&k._fixFull()}a._noSel(c);if(k.config.showToolbarGroupHandle){var h=c.getElementsByTagName("DIV")[0].offsetWidth;if(h>0)c.style.marginLeft="-"+h+"px"}e=a._tags(c,"A");for(d=e.length-1;d>=0;d--){a.addListener(e[d],"click",k._toolbarBottonClick);a.addListener(e[d],"mouseout",function(){var b=a.activePop;this.className=b&&b.relateObj==this?"eButtonDropDown":"eButton"})}k._updateToolbar("visual"===k.currentMode(),["toolbarmode","mode","fullscreen","help"],true)};k.fullScreen=function(d){var c=k._containerDiv,f="visual"===k.currentMode(),m,i,h=g?"position":"fixed";if(d===j||null===d)d=c.style.position!=h;else if(d==(c.style.position==h))return;f&&k.changeMode("code");if(d){b.body.parentNode.style.overflow="hidden";b.body.appendChild(c);if(f)if(l)e.setTimeout(function(){k.changeMode("visual")},1);else k.changeMode("visual");c.style.position=h;c.style.top="0px";c.style.left="-1px";k._fixFull();a.addListener(e,"resize",k._fixFull)}else{b.body.parentNode.style.overflow="auto";a.delListener(e,"resize",k._fixFull);c.style.position="";c.style.width=k.config.width;m=k._editorObj();m.style.height=k.config.height+"px";k.obj.parentNode.insertBefore(c,k.obj);f&&k.changeMode("visual");c.scrollIntoView(false)}i=k._button("fullscreen");if(i)i.id=d?"eBTNfullscreen-reset":"eBTNfullscreen"};k.setContent=function(a){if("code"===k.currentMode())k._editorObj().value=a;else{if("function"===typeof k.config.onsetcontent)a=k.config.onsetcontent.call(k,a);k._getDoc().body.innerHTML=a}k.save()};k._initContent=function(b){if("code"!==k.currentMode()){if(l&&"<br>"==b.substring(0,4))b=b.substr(4);if(l)b=b.replace(/<td([^>]*)>\s*<\/td/ig,"<td$1 ><br></td");var a=g?"":"<!DOCTYPE html>",c=k._getDoc(),d;a+="<html><head><style>\nbody{border:none;height:100%;margin:0;padding:2px;overflow:auto;";if(k.config.bgColor||k.config.textColor){if(k.config.bgColor)a+="background-color:"+k.config.bgColor+";";if(k.config.textColor)a+="color:"+k.config.textColor+";"}a+='}\nimg{cursor:default;}\n.selectedTD{background:#3399ff !important;}\n.splitPage{display:block;width:98%;!important;border-top:#999 1px solid;border-bottom:#999 1px solid;background:#FFFFFF; color:#000000;font-weight:bold;text-align:center;margin:30px auto 5;padding-top:30px;clear:both;}\n.splitPage:before{content:"'+E+'";}';if(k.config.cssCode)a+=k.config.cssCode;a+="</style>\n";if(k.config.baseHref!="")a+='<base href="'+k.config.baseHref+'" />';if(k.config.css)a+='<link href="'+k.config.css+'" rel="stylesheet" type="text/css">\n';a+='</head><body contenteditable="true" ></body></html>';c.open();c.write(a);c.close();d=Math.max(20,k._editorObj().offsetHeight-6);if(c.body){c.body.style.minHeight=d+"px";if(g)c.body.style.height=d+"px"}}k.setContent(b);k._changed()};k.setOpacity=function(b,a){if(f)b.style.filter=a==100?"":"gray() alpha(opacity="+a+")";else b.style.opacity=a==100?"":a/100};k.inArray=function(c,b){for(var a=b.length-1;a>=0;a--)if(c==b[a])return true;return false};k.content=function(){var e=k.currentMode(),d,c,b;if("visual"===e){d=k.selectedCells();for(c=d.length-1;c>=0;c--)d[c].className="";b=k._getDoc().body.innerHTML;for(c=d.length-1;c>=0;c--)d[c].className="selectedTD";if(l&&"<br>"==b.substring(0,4))b=b.substr(4);if(""==b.replace(/<\/?(div|p|font|b|s|u|i|strong|em|strike)(?![a-z0-9])[^>]*>|&nbsp;|\s/ig,""))b="";if("function"===typeof k.config.ongetcontent)b=k.config.ongetcontent.call(k,b);else b=a.formatHTML(b)}else b=k._editorObj().value;return b};k._autoSave=function(d){var c=k._editorObj(),b=d?a.addListener:a.delListener;if(f)b(c,"beforedeactivate",k.save);else if("code"==k.currentMode())b(c,"blur",k.save);else b(c.contentWindow,"blur",k.save)};k.save=function(){k.obj.value=k.content()};k._intEdit=function(a){if(a.isIniEdit)return;a.isIniEdit=true;a.style.imeMode="disabled";a.onkeypress=function(){if(45==event.keyCode){this.value="-"==this.value.charAt(0)?this.value.substr(1):"-"+this.value;return false}return event.keyCode>=48&&event.keyCode<=57};a.onpaste=function(){return!clipboardData.getData("text").match(/\D/)};a.ondragenter=function(){return!/\D/.test(event.dataTransfer.getData("text"))};a.oldBlur=a.onblur;a.onblur=function(){if(""==this.value)return;this.value=parseInt(this.value,10);var a=this.getAttribute("max"),b=this.getAttribute("min");if(a!==j&&parseInt(this.value,10)>parseInt(a,10))this.value=parseInt(a,10);if(b!=j&&parseInt(this.value,10)<parseInt(b,10))this.value=parseInt(b,10);this.oldBlur&&this.oldBlur()}};if(g||f&&(b.documentMode==7||b.compatMode!="CSS1Compat")){var s=function(a){var b=null;while(a){if(a.tagName=="TABLE")b=a;a=a.parentNode}return b},v=s(b.scripts(b.scripts.length-1));if(v&&s(a.find(t))===v)e.setTimeout(k.init,20);else k.init()}else k.init()};a.url="./";a.version=v;if(a.url==="./"){var t=b.scripts||b.getElementsByTagName("SCRIPT"),m=t[t.length-1].getAttribute("src"),s=/[\?&]skin=([a-z0-9_A-Z]+)/.exec(m),k=e.location,u=k.protocol+"//"+k.host+(k.port?":"+k.port:"")+"/",Y="";m=m.split("?")[0];a.url=m.substring(0,m.lastIndexOf("/"));if(""==a.url)a.url="./";else a.url+="/";if(a.url.indexOf(u)===0)a.url=a.url.substring(u.length-1,a.url.length);b.write('<link href="'+a.url+(s?"skin/"+s[1]+"/":"")+'TQEditor.css" id="TQEditorSkinCSS" rel="stylesheet" type="text/css" onload="TQE.checkSkin(this)" />');f&&b.compatMode!="CSS1Compat"&&b.write('<link href="'+a.url+'QuirksMode.css" id="TQEditorQuirksMode" rel="stylesheet" type="text/css" onload="TQE.checkSkin(this)" />')}a.config={paragraphs:[["\u6b63\u6587","p"],["\u6807\u98981","h1"],["\u6807\u98982","h2"],["\u6807\u98983","h3"],["\u6807\u98984","h4"],["\u6807\u98985","h5"],["\u6807\u98986","h6"],["\u9884\u5b9a\u4e49","pre"]],fontnames:[["\u5b8b\u4f53","\u5b8b\u4f53"],["\u65b0\u5b8b\u4f53","\u65b0\u5b8b\u4f53"],["\u4eff\u5b8b_GB2312","\u4eff\u5b8b_GB2312"],["\u9ed1\u4f53","\u9ed1\u4f53"],["\u5fae\u8f6f\u96c5\u9ed1","\u5fae\u8f6f\u96c5\u9ed1"],["\u6977\u4f53_GB2312","\u6977\u4f53_GB2312"],["Arial","arial, helvetica, sans-serif"],["Courier New","courier new, courier, mono"],["Georgia","Georgia, Times New Roman, Times, Serif"],["Tahoma","Tahoma, Arial, Helvetica, sans-serif"],["Times New Roman","times new roman, times, serif"]],fontsizes:[["\u7279\u5c0f","xx-small",1],["\u8f83\u5c0f","x-small",2],["\u5c0f","small",3],["\u4e2d","medium",4],["\u5927","large",5],["\u8f83\u5927","x-large",6],["\u7279\u5927","xx-large",7]],toolbar:"default",toolbarRight:[],advToolbar:["paragraph","fontname","fontsize","br","bold","italic","underline","strikethrough","forecolor","backcolor","removeformat","typeset","||","justifyleft","justifycenter","justifyright","justifynone",["superscript","subscript"],"br","orderedlist","unorderedlist","indent","outdent","||","inserthorizontalrule","splitpage","cleanword","br","createlink","unlink","inserttable","||","insertface","insertimage","insertmusic","insertflash","insertvideo"],advToolbarRight:["toolbarmode","br","fullscreen","mode","help"],advToolbarMode:false,showToolbarGroupHandle:true,tplFlash:'<embed  src="{$url}" width="{$width}" height="{$height}" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" allowscriptaccess="always"></embed>',tplFlv:'<embed src="'+a.url+'flvPlayer.swf" flashvars="vcastr_file={$url}&IsAutoPlay={$auto_start}" width="{$width}" height="{$height}" quality="high" bgcolor="#0E0E0E" name="play" align="middle" allowscriptaccess="sameDomain" allowfullscreen="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="opaque" />',tplRm:'<embed  src="{$url}" width={$width} height={$height} autostart="{$auto_start}"type="audio/x-pn-realaudio-plugin" console="Clip1" controls="ImageWindow" ></embed>',tplVideo:'<object classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6"  type="application/x-ms-wmp" width="{$width}" height="{$height}"><PARAM NAME="URL" VALUE="{$url}" /><PARAM NAME="autoStart" VALUE="{$auto_start}" /><PARAM NAME="invokeURLs" VALUE="false"><PARAM NAME="playCount" VALUE="100"><PARAM NAME="Volume" VALUE="100"><PARAM NAME="defaultFrame" VALUE="datawindow"></object>',tplMusic:'<object id="tqeMP"  classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6"  type="application/x-ms-wmp" width="230" height="64"><PARAM NAME="URL" VALUE="{$url}" /><PARAM NAME="autoStart" VALUE="{$auto_start}" /><PARAM NAME="invokeURLs" VALUE="false"><PARAM NAME="playCount" VALUE="100"><PARAM NAME="Volume" VALUE="100"><PARAM NAME="defaultFrame" VALUE="datawindow"></object>',tplSplitPage:'<h3 class="splitPage" name="split_page"></h3>',uploadFieldName:"file",imageUploadUrl:"",imageFileTypes:"*.jpg;*.gif;*.png;*.jpeg",imageFileSize:"2MB",directInsertUploadImage:false,linkUploadUrl:"",linkFileTypes:"*.*",linkFileSize:"2MB",flashUploadUrl:"",flashFileTypes:"*.swf",flashFileSize:"2MB",musicUploadUrl:"",musicFileTypes:"*.mp3;*.wma",musicFileSize:"2MB",videoUploadUrl:"",videoFileTypes:"*.flv;.mp4;*.mkv;*.wmv;*.asf;*.avi;*.rmvb;*.rm",videoFileSize:"2MB",enter2br:false,width:"auto",height:"auto",autoClean:true,faceCount:55,css:"",cssCode:"",bgColor:"",textColor:"",autoPopImagePanel:true,autoPopTablePanel:true,typesetImageTextCenter:true,typesetIndentParagraph:false,typesetImageBorder:true,baseHref:"",resize:true,onfocus:null,onblur:null,onkeydown:null,onkeyup:null,onpaste:null,oninit:null,ongetcontent:null,onsetcontent:null,debug:false};a.find=function(a){return b.getElementById(a)};a.CE=function(f,d,c,e){var a=b.createElement(f);if(d)a.id=d;if(c)a.innerHTML=c;e&&b.body.appendChild(a);return a};a.loadSkin=function(b){var c=a.find("TQEditorSkinCSS");c.href=a.url+(b&&"default"!=b?"skin/"+b+"/":"")+"TQEditor.css"};a.checkSkin=function(e){for(var d=b.styleSheets,f,c=d.length-1;c>=0;c--)if(d[c].href==e.href){f=d[c].cssRules||d[c].rules;if(f.length<1)e.href=a.url+"TQEditor.css";break}};a._doc=function(){return b.compatMode!="CSS1Compat"?b.body:b.documentElement};a._docST=function(){return e.scrollY?e.scrollY:a._doc().scrollTop};a._docSL=function(){return e.scrollX?e.scrollX:a._doc().scrollLeft};a.pos=function(b){var c=0,d=0,e=b.getBoundingClientRect(),f=a._doc();c=e.left+a._docSL()-f.clientLeft;d=e.top+a._docST()-f.clientTop;return{x:c,y:d,left:c,top:d,width:b.offsetWidth,height:b.offsetHeight}};a._hideContext=function(){if(a.activeContext){a.activeContext.style.display="none";a.activeContext=null}};a.pop=function(b,c){if(a.activePop==b){a.hidePop();return false}a._hideContext();a.hidePop();a.activePop=b;b.relateObj=c;c.className="eButtonDropDown";b.style.display="block";var e=a.pos(c),d=e.x,g=1+c.clientHeight+e.y,f=a._docSL(),h=a._doc().clientWidth;if(d+b.offsetWidth>f+h)d-=b.offsetWidth-c.offsetWidth;b.style.left=d+"px";b.style.top=g+"px";return true};a.hidePop=function(){if(!a.activePop)return;var b=a.activePop;a.activePop=null;b.style.display="none";if(b.relateObj&&b.relateObj.className=="eButtonDropDown")b.relateObj.className="eButton";b=a.find("ColorPicker");if(b)b.style.display="none"};a.delListener=function(a,b,c){if(a.removeEventListener)a.removeEventListener(b,c,false);else a.detachEvent("on"+b,a["e"+b+c])};a.addListener=function(a,c,b){if(a.addEventListener)a.addEventListener(c,b,false);else{a["fn"+b]=b;a["e"+c+b]=function(c){a["fn"+b](c)};a.attachEvent("on"+c,a["e"+c+b])}};a._tags=function(a,b){return a.getElementsByTagName(b)};a.listenTags=function(f,g,d,e){for(var c=a._tags(f,g),b=c.length-1;b>=0;b--)a.addListener(c[b],d,e)};a._noSel=function(e,g){var h=function(){if(f){var a=event.srcElement.tagName;return"INPUT"==a||"TEXTAREA"==a}return false};if(g)for(var i=g.split(","),c,b,d=i.length-1;d>=0;d--){c=a._tags(e,i[d]);for(b=c.length-1;b>=0;b--){c[b].unselectable="on";c[b].onselectstart=h}}else{e.unselectable="on";e.onselectstart=h}};a._colorPickerUI=function(){for(var c=["00","33","66","99","CC","FF"],g=["FF0000","00FF00","0000FF","FFFF00","00FFFF","FF00FF"],h=191,b='<table width="'+h+'" cellpadding=0 cellspacing=0 border=0   style="border-collapse:collapse;" >',a,e,f=function(a){return'<td bgcolor="#'+a+'" style="width:10px;height:10px;border:1px solid #999; overflow:hidden;padding:0;margin:0;"></td>'},d=0;d<2;d++)for(a=0;a<6;a++){b+="<tr height=10>";if(d>0)b+=f(g[a]);else b+=f(c[a]+c[a]+c[a]);for(e=0;e<3;e++)for(k=0;k<6;k++)b+=f(c[e+d*3]+c[k]+c[a]);b+="</tr>"}b+='</table><div style="padding:2px 2px 1px 2px;line-height:25px;"><div style="height:25px;width:60px;display:block;float:left; margin-right:5px;" name=colorPreview></div><span name="colorValue" style="width:50px; display:inline-block;"></span><input type="button" value="'+P+'" /></div>';return b};a.pickColor=function(f,h,i){var c=a.find("ColorPicker");if(null==c){c=a.CE("DIV","ColorPicker",a._colorPickerUI(),true);c.className="ePopPanel";c.style.zIndex=99999999;c.onmouseover=function(){this.active=true};c.onmouseout=function(){this.active=false};a._noSel(c);a.listenTags(c,"TD","mouseover",function(){var a=this,b=this.parentNode.parentNode.parentNode.parentNode.lastChild,c=e.setInterval(function(){a.style.backgroundColor=a.style.backgroundColor!=""?"":"#FFFFFF"},500);b.firstChild.style.backgroundColor=this.bgColor;b.firstChild.nextSibling.innerHTML=this.bgColor;a.style.backgroundColor="#FFFFFF";a.onmouseout=function(){e.clearInterval(c);this.style.backgroundColor=""}});c.lastChild.lastChild.onclick=function(){this.parentNode.parentNode.style.display="none"};a.listenTags(c,"TD","mouseup",function(){this.parentNode.parentNode.parentNode.parentNode.style.display="none"});a.addListener(b,"mousedown",function(){var b=a.find("ColorPicker");if(!b.active)b.style.display="none"})}for(var g=a._tags(c,"TD"),d=g.length-1;d>=0;d--)g[d].onmousedown=function(a){f(this.bgColor);a=a||event;a.cancelBubble=true};c.lastChild.lastChild.onclick=function(a){f("");a=a||event;a.cancelBubble=true};c.style.left=h+"px";c.style.top=i+"px";c.style.display="block"};a.drag=function(b){b.style.position="absolute";b.style.userSelect="none";b.style.mozUserSelect="none";b.style.webkitUserSelect="none";b.dragging=false;b.onmousedown=function(c){var i,j,g,d,h=a.pos(this),k=a._docSL(),l=a._docST();if(f){c=e.event;g=c.srcElement;i=k+c.clientX-h.x;j=l+c.clientY-h.y}else{g=c.target;i=c.pageX-h.x;j=c.pageY-h.y}if(b.dragging)return;d=g.tagName;if(g!=this&&(d=="INPUT"||d=="TEXTAREA"||d=="BUTTON"||d=="SELECT"))return;b.dragging=true;var m=function(a){if(f){a=e.event;a.pageX=k+a.clientX;a.pageY=l+a.clientY}var c=a.pageX-i,d=a.pageY-j;b.style.left=c+"px";b.style.top=d+"px";b.style.cursor="move"},n=function(){b.style.cursor="";b.dragging=false};a._draging(m,n,b)}};a._draging=function(f,g,d){if(a._draging.running)return;if(d.setCapture)d.setCapture();else e.captureEvents&&e.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);a._draging.running=true;a._draging.mm=b.onmousemove;a._draging.mu=b.onmouseup;var c=a.CE("DIV","","",true);c.className="eDragMaskDiv";c.style.height=Math.max(b.documentElement.clientHeight,b.body.scrollHeight)+"px";b.onmousemove=f;b.onmouseup=function(f){c&&b.body.removeChild(c);c=null;b.onmousemove=a._draging.mm;b.onmouseup=a._draging.mu;if(d.releaseCapture)d.releaseCapture();else e.releaseEvents&&e.releaseEvents(Event.MOUSEMOVE|Event.MOUSEUP);a._draging.running=false;g(f)};return c};a._draging.running=null;a.clone=function(b){if(typeof b!="object")return b;if(b==null)return b;var c,d="[object Array]"==Object.prototype.toString.call(b)?[]:{};for(c in b)d[c]=a.clone(b[c]);return d};a.removeNode=function(a,b){if(a.removeNode)return a.removeNode(b);if(b)return a.parentNode.removeChild(a);while(a.firstChild)a.parentNode.insertBefore(a.firstChild,a);a.parentNode.removeChild(a)};a.updateCellsStatus=function(k){for(var e=k.rows,d,j,f,i,a,c,g,b=0;b<e.length;b++){c=0;for(a=0;a<e[b].cells.length;a++){f=e[b].cells[a];f.colStart=c;c+=f.colSpan;f.colEnd=c-1;f.rowStart=b;f.rowEnd=b+f.rowSpan-1}}for(b=0;b<e.length;b++){d=e[b].cells;for(a=0;a<d.length;a++){if(d[a].rowSpan<2)continue;for(c=1;c<d[a].rowSpan;c++){if(!e[b+c])break;j=e[b+c].cells;f=d[a];for(g=0;g<j.length;g++){i=j[g];if(i.colStart>=f.colStart){i.colStart+=f.colSpan;i.colEnd+=f.colSpan}}}}}for(b=e.length-1;b>=0;b--){d=e[b].cells;var h=d[0].rowSpan;for(a=d.length-1;a>0;a--){h=Math.min(h,d[a].rowSpan);if(h<2)break}if(--h>0){for(a=d.length-1;a>=0;a--){d[a].rowSpan-=h;d[a].rowEnd-=h}for(c=b-1;c>=0;c--)for(g=e[c].cells.length-1;g>=0;g--)if(e[c].cells[g].rowEnd>d[0].rowStart){e[c].cells[g].rowSpan-=h;e[c].cells[g].rowEnd-=h}}}};a.insertCol=function(j,l){var i=j.parentNode.parentNode.parentNode,g,e,b,h=0,f,c,d,k,m=i.rows.length;a.updateCellsStatus(i);c=l?j.colStart:j.colEnd+1;while(h<m){k=i.rows[h];h++;g=k.cells;e=null;for(f=Math.min(c,g.length-1);f>=0;f--){d=g[f];if(d.colStart<=c){if(d.colStart<c&&d.colEnd>=c){d.colSpan++;d.colEnd++;h+=d.rowSpan-1}else e=k.insertCell(d.colStart!=c&&(d.colEnd==c-1||f==g.length-1)?f+1:f);if(e)if(l){b=e.nextSibling;if(b&&b.rowSpan<2&&b.colStart==c)e.style.backgroundColor=b.style.backgroundColor}else{b=e.previousSibling;if(b&&b.rowSpan<2&&b.colEnd==c-1)e.style.backgroundColor=b.style.backgroundColor}break}}}};a.insertRow=function(h,k){var e=h.parentNode.parentNode.parentNode,c,i,g,d,b,j=0,f;a.updateCellsStatus(e);f=k?h.rowStart:h.rowEnd+1;for(d=Math.min(e.rows.length-1,f-1);d>=0;d--){c=e.rows[d].cells;for(b=c.length-1;b>=0;b--)if(c[b].rowEnd>=f){c[b].rowSpan++;j+=c[b].colSpan}}c=e.rows[0].cells;for(b=c.length-1;b>=0;b--)j-=c[b].colSpan;i=e.insertRow(f);while(j++<0)i.insertCell(0).innerHTML="&nbsp;";a.updateCellsStatus(e);c=i.cells;g=e.rows[k?f+1:f-1].cells;b=g.length-1;for(d=c.length-1;d>=0;d--){while(b>=0&&g[b].colStart>c[d].colStart)b--;if(b>=0&&g[b].colStart==c[d].colStart&&g[b].colEnd==c[d].colEnd)c[d].style.backgroundColor=g[b].style.backgroundColor}};a.deleteCol=function(i){var g=i.parentNode.parentNode.parentNode,f=g.rows,b,d,h,e,c;a.updateCellsStatus(g);e=i.colStart;c=i.colEnd;for(d=f.length-1;d>=0;d--){for(h=Math.min(c,f[d].cells.length-1);h>=0;h--){b=f[d].cells[h];if(b.colEnd>=e&&b.colStart<=c)if(b.colStart>=e&&b.colEnd<=c)f[d].removeChild(b);else if(b.colStart<e&&b.colEnd>c)b.colSpan-=1+c-e;else if(b.colStart<e&&b.colEnd>=e)b.colSpan-=b.colEnd-e+1;else if(b.colStart<=c&&b.colEnd>c){b.colSpan-=1+c-b.colStart;b.innerHTML=""}}f[d].cells.length<1&&f[d].parentNode.removeChild(f[d])}f.length<1&&g.parentNode.removeChild(g)};a.deleteRow=function(k){var j=k.parentNode.parentNode.parentNode,c=j.rows,h,b,g,d,l,i,f,e;a.updateCellsStatus(j);f=k.rowStart;e=k.rowEnd;delRowCount=k.rowSpan;h=c[e+1];for(d=Math.min(e,c.length-1);d>=0;d--){for(l=c[d].cells.length-1;l>=0;l--){b=c[d].cells[l];if(b.rowEnd>=f&&b.rowStart<=e)if(b.rowStart>=f&&b.rowEnd<=e)c[d].removeChild(b);else if(b.rowStart<f&&b.rowEnd>e)b.rowSpan-=delRowCount;else if(b.rowStart<f&&b.rowEnd>=f)b.rowSpan-=b.rowEnd-f+1;else if(b.rowStart<=e&&b.rowEnd>e){if(h){for(i=0;i<h.cells.length;i++)if(h.cells[i].colStart>b.colEnd)break;g=h.insertCell(i);g.rowSpan=b.rowSpan-delRowCount;g.colSpan=b.colSpan;g.colStart=b.colStart;g.colEnd=b.colEnd;g.style.backgroundColor=b.style.backgroundColor}c[d].removeChild(b)}}c[d].cells.length<1&&c[d].parentNode.removeChild(c[d])}c.length<1&&j.parentNode.removeChild(j)};a.formatHTML=function(a){return a.replace(/\s*<(p|table|tr|hr|div|object|ol|li|ul|h[1-6])(?![a-z])/ig,"\n<$1").replace(/<\/(p|table|div|object|ol|ul|h[1-6])>\s*/ig,"</$1>\n").replace(/(<(?:br|hr)(?![a-z0-9])[^>]*>)\s*/ig,"$1\n").replace(/^\s*/,"").replace(/\s*$/,"")};a.toolbarMode={admin:{left:["paragraph","fontsize","|","bold","italic","underline","forecolor","backcolor","removeformat","|","justifyleft","justifycenter","orderedlist","unorderedlist",["justifyright","|","indent","outdent","|","superscript","subscript"],"||","createlink","insertimage","inserttable",["splitpage","inserthorizontalrule"],"|","insertmusic","insertflash","insertvideo","||","cleanword","typeset"],right:["toolbarmode","fullscreen","|","help"]},bbs:{left:["fontsize","|","bold","italic","underline","forecolor","backcolor","removeformat","|","justifyleft","justifycenter","justifyright","||","createlink","insertimage","|","insertface","insertmusic","insertflash","insertvideo","|","typeset"],right:["toolbarmode","fullscreen","|","help"]},user:{left:["fontsize","|","bold","italic","underline","forecolor","backcolor","removeformat","|","justifyleft","justifycenter","orderedlist",["justifyright","unorderedlist","|","indent","outdent","|","inserthorizontalrule"],"||","createlink","insertimage","insertvideo","|","typeset"],right:["toolbarmode","fullscreen","|","help"]},mini:{left:["fontsize","|","bold","italic","underline","forecolor","backcolor","removeformat","|","align","|","createlink","insertimage"],right:["help"]},message:{left:["insertface","|","bold","italic","underline","forecolor","removeformat"],right:["help"]},full:{left:["paragraph","fontname","fontsize","|","bold","italic","underline","strikethrough","forecolor","backcolor","removeformat","||","align","list","iodent",["superscript","subscript"],"||","createlink","unlink","insertimage","inserttable","inserthorizontalrule","splitpage","insertface","|","insertmusic","insertflash","insertvideo","||","cleanword","typeset"],right:["toolbarmode","fullscreen","mode","|","help"]},normal:{left:["paragraph","fontsize","|","bold","italic","underline","forecolor","backcolor","removeformat","||","justifyleft","justifycenter","orderedlist","unorderedlist","||","createlink","insertimage","inserttable","|","insertvideo","|","typeset"],right:["toolbarmode","fullscreen","|","help"]}};a.toolbarBottons={paragraph:{text:"\u6bb5\u843d",click:function(d,j){var c=a.find(d.objId+"Paragraph"),b;if(null==c){var i="",e=d.config.paragraphs;for(b=0;b<e.length;b++)i+='<div name="FormatBlock" class="eMenuItem" unselectable=on onselectstart="return false" paraValue="'+e[b][1]+'">'+e[b][0]+"</div>";c=a.CE("DIV",d.objId+"Paragraph",i,true);c.className="ePopPanel";a._noSel(c);a.listenTags(c,"DIV","click",function(){a.hidePop();var b=this.getAttribute("paraValue");if(f)b="<"+b+">";d.exeCmd("FormatBlock",b)});if(g){var h=a._tags(c,"DIV");for(b=h.length-1;b>=0;b--)d._ieMouseStyle(h[b],"eMenuItem","eMenuItemUp","eMenuItem")}}a.pop(c,j)}},fontsize:{text:"\u6587\u5b57\u5927\u5c0f",click:function(d,i){var c=a.find(d.objId+"FontSize");if(null==c){for(var h="",f,e=d.config.fontsizes,b=0;b<e.length;b++)h+='<div name="FontSize" class="eMenuItem" unselectable=on onselectstart="return false" paraValue="'+e[b][2]+'" style="font-size:'+e[b][1]+';" >'+e[b][0]+"</div>";c=a.CE("DIV",d.objId+"FontSize",h,true);c.className="ePopPanel";a._noSel(c);a.listenTags(c,"DIV","click",function(){a.hidePop();d.exeCmd("FontSize",this.getAttribute("paraValue"))});if(g){f=a._tags(c,"DIV");for(b=f.length-1;b>=0;b--)d._ieMouseStyle(f[b],"eMenuItem","eMenuItemUp","eMenuItem")}}a.pop(c,i)}},fontname:{text:"\u5b57\u4f53",click:function(d,i){var c=a.find(d.objId+"FontName");if(null==c){for(var f,h="",e=d.config.fontnames,b=0;b<e.length;b++)h+='<div name="FontName" class="eMenuItem" unselectable=on onselectstart="return false"  paraValue="'+e[b][1]+'"  style="font-family:'+e[b][1]+';" >'+e[b][0]+"</div>";c=a.CE("DIV",d.objId+"FontName",h,true);c.className="ePopPanel";a._noSel(c);a.listenTags(c,"DIV","click",function(){a.hidePop();d.exeCmd("FontName",this.getAttribute("paraValue"))});if(g){f=a._tags(c,"DIV");for(b=f.length-1;b>=0;b--)d._ieMouseStyle(f[b],"eMenuItem","eMenuItemUp","eMenuItem")}}a.pop(c,i)}},forecolor:{text:"\u6587\u672c\u989c\u8272",click:function(b,a){b._showColorSelectUI(a,"forecolor")}},backcolor:{text:"\u80cc\u666f\u8272",click:function(b,a){b._showColorSelectUI(a,f?"backcolor":"hilitecolor")}},bold:{text:"\u7c97\u4f53",click:null},italic:{text:"\u659c\u4f53",click:null},underline:{text:"\u4e0b\u5212\u7ebf",click:null},strikethrough:{text:"\u5220\u9664\u7ebf",click:null},removeformat:{text:"\u6d88\u9664\u683c\u5f0f",click:function(e){a.hidePop();e.exeCmd("removeformat");if(l)return;var g=e._getRange(),f=function(a){return a.replace(/<\/?span[^>]*>/ig,"").replace(/<p [^>]*>/ig,"<p>").replace(/<div [^>]*>/ig,"<div>")},h="",d=g.htmlText,c,b;if(d)e.insertHtml(f(d));else{c=g.cloneContents().childNodes;for(b=0;b<c.length;b++)if("#comment"!=c[b].nodeName){d=c[b].outerHTML||c[b].nodeValue;if(d)h+=d}e.insertHtml(f(h))}}},submenu:{text:"",click:function(b,a){b._popAsMenu(a,a.getAttribute("submenu").split(","))}},subscript:{text:"\u4e0b\u6807",click:null},superscript:{text:"\u4e0a\u6807",click:null},align:{text:"\u5bf9\u9f50",click:function(b,a){b._popAsMenu(a,["justifyleft","justifycenter","justifyright"])}},justifyleft:{text:"\u5de6\u5bf9\u9f50",click:null},justifycenter:{text:"\u5c45\u4e2d\u5bf9\u9f50",click:null},justifyright:{text:"\u53f3\u5bf9\u9f50",click:null},justifyfull:{text:"\u4e24\u7aef\u5bf9\u9f50",click:null},justifynone:{text:"\u53d6\u6d88\u5bf9\u9f50",click:null},list:{text:"\u5217\u8868",click:function(b,a){b._popAsMenu(a,["orderedlist","unorderedlist"])}},unorderedlist:{text:"\u9879\u76ee\u5217\u8868",click:function(b){a.hidePop();b.exeCmd("InsertUnorderedList")}},orderedlist:{text:"\u6570\u76ee\u5217\u8868",click:function(b){a.hidePop();b.exeCmd("InsertOrderedList")}},iodent:{text:"\u7f29\u8fdb\u65b9\u5411",click:function(b,a){b._popAsMenu(a,["indent","outdent"])}},outdent:{text:"\u51cf\u5c11\u7f29\u8fdb",click:null},indent:{text:"\u589e\u52a0\u7f29\u8fdb",click:null},inserthorizontalrule:{text:"\u63d2\u5165\u6c34\u5e73\u7ebf",click:null},createlink:{text:"\u6dfb\u52a0\u94fe\u63a5",click:function(b,h){var d=a.find(b.objId+"CreateLink");if(null==d){var g=function(){a.hidePop();var g=this.form.elements,f=g.url.value,d=g.target.value,e=g.title.value,h="";if("http://"==f||""==f){b.exeCmd("Unlink");return false}var i=b._getRange();if(n&&i.collapsed||!b.exeCmd("CreateLink",f)){if(d!=="")d=' target="'+d+'" ';if(e!=="")h=' title="'+e+'" ';b.insertHtml('<a href="'+f+'" '+h+d+">"+(e?e:f)+"</a>");return false}var c=b.focusNode();do if(c.tagName=="A"){if(""==d)c.removeAttribute("target");else c.setAttribute("target",d);if(""==e)c.removeAttribute("title");else c.setAttribute("title",e);break}while(c=c.parentNode);return false};d=b._popFormUI(b.objId+"CreateLink",K,D,g,null,b.config.linkUploadUrl,b.config.linkFileTypes,b.config.linkFileSize,"link");a.drag(d)}if(!a.pop(d,h))return;var f=a._tags(d,"FORM")[0],e=f.elements,c=b.focusNode();f.reset();do if(c.tagName=="A"){e.url.value=c.getAttribute("href");e.title.value=c.getAttribute("title");b.__selectOption(e.target,c.getAttribute("target"));break}while(c=c.parentNode);e.url.focus()}},unlink:{text:"\u5220\u9664\u94fe\u63a5",click:null},inserttable:{text:"\u63d2\u5165\u8868\u683c",click:function(g,t){var e=a.find(g.objId+"InsertTable");if(null==e){for(var o=y+'<div><table border=1 cellspacing=0 cellpadding=0 bgcolor="#FFFFFF"  bordercolor="#CCCCCC"  class="eTableInserUI"><tbody>',b=0,s=0,b=0;b<5;b++){o+="<tr>";for(s=0;s<8;s++)o+='<td width="20" height="20" ></td>';o+="</tr>"}o+='</tbody></table><div style="padding:2px 5px;">1 &times 1</div></div>';e=a.CE("DIV",g.objId+"InsertTable",o,true);e.className="ePopPanel";a._noSel(e);a.listenTags(e.lastChild,"TD","click",function(){a.hidePop();for(var c,b='<table style="border-collapse:collapse;" width=96% align=center border=1 cellspace=0 cellpadding=3 ><tbody>',d=this.parentNode.rowIndex;d>=0;d--){b+="<tr>";for(c=this.cellIndex;c>=0;c--)b+=f?'<td valign="top"></td>':'<td valign="top"><br></td>';b+="</tr>"}b+="</tbody></table>";g.insertHtml(b)});a.listenTags(e.lastChild,"TD","mouseover",function(){for(var b,e=this.cellIndex,a=this.parentNode,f=a.rowIndex,d=a.parentNode.parentNode,h=d.rows.length,g=a.cells.length,c=0;c<h;c++){a=d.rows[c];for(b=0;b<g;b++)a.cells[b].bgColor=c<=f&&b<=e?"#3399ff":""}d.parentNode.lastChild.innerHTML=f+1+" &times; "+(e+1)})}var d,c,l=g.selectedCells(),p=e.firstChild,q=p.firstChild,r=q.nextSibling,m=e.lastChild,n=e.lastChild.firstChild.firstChild.firstChild,u=n.cells.length,k=function(a,b){a.style.display=b?"":"none"};while(n){for(var b=0;b<u;b++)n.cells[b].bgColor="";n=n.nextSibling}m.lastChild.innerHTML="1 &times; 1";if(l.length){k(m,0);c=l[0]}else{k(m,1);c=g.focusNode();while(c&&c.nodeName!=="TD")c=c.parentNode}if(c){d=c.parentNode.parentNode.parentNode;k(p,1);k(q,g.canMergeSelectedCells());k(r,l.length<2&&(c.rowSpan>1||c.colSpan>1));k(r.nextSibling,q.style.display!="none"||r.style.display!="none")}else k(p,0);k(m.previousSibling,p.style.display!="none"&&m.style.display!="none");var i=e.firstChild.getElementsByTagName("A"),h=function(d,b){if(l.length>0)for(var a=l.length-1;a>=0;a--){l[a].align=d;l[a].vAlign=b}else if(c){c.align=d;c.vAlign=b}};for(b=i.length-1;b>=0;b--){i[b].href="#";i[b].onclick=function(){switch(this.id){case"eTableAlignDefault":d.align="";break;case"eTableAlignLeft":d.align="left";break;case"eTableAlignCenter":d.align="center";break;case"eTableAlignRight":d.align="right";break;case"eCellAlignLT":h("left","top");break;case"eCellAlignCT":h("center","top");break;case"eCellAlignRT":h("right","top");break;case"eCellAlignLC":h("left","middle");break;case"eCellAlignCC":h("center","middle");break;case"eCellAlignRC":h("right","middle");break;case"eCellAlignLB":h("left","bottom");break;case"eCellAlignCB":h("center","bottom");break;case"eCellAlignRB":h("right","bottom")}g.focus();return false}}i=e.firstChild.getElementsByTagName("INPUT");for(b=i.length-1;b>=0;b--){if(d)i[b].value=j==d[i[b].id]?"":d[i[b].id];i[b].onblur=function(){if(""==this.value)d.removeAttribute(this.id);else d[this.id]=this.value;d.style.borderCollapse=d.cellSpacing<1&&d.border==1?"collapse":""}}q.onclick=function(){a.hidePop();g.mergeSelectedCells();g.focus();return false};r.onclick=function(){a.hidePop();g.splitCell(c);g.focus();return false};if(!a.pop(e,t))return void 0}},insertimage:{text:"\u63d2\u5165\u56fe\u7247",click:function(d,i){var f=a.find(d.objId+"InsertImage");if(null==f){var h=function(){a.hidePop();var b=this.form.elements;d.insertImage(b.url.value,b.width.value,b.height.value,b.border.value,b.alt.value,b.align.value);return false};f=d._popFormUI(d.objId+"InsertImage",H,A,h,["width","height","border"],d.config.imageUploadUrl,d.config.imageFileTypes,d.config.imageFileSize,"image");a.drag(f)}if(!a.pop(f,i))return;var g=a._tags(f,"FORM")[0],e=g.elements,b=d._getRange(),c=b.commonAncestorContainer;g.reset();if(c){if(!b.collapsed&&b.startContainer==b.endContainer&&b.startOffset-b.endOffset<2&&b.startContainer.hasChildNodes())c=b.startContainer.childNodes[b.startOffset];if(c.tagName!="IMG"&&q>=9&&""===b.toString())if(j===b.startContainer.length&&b.startContainer.firstChild===b.endContainer.previousSibling)c=b.startContainer.firstChild;else if(b.endContainer.lastChild===b.startContainer.nextSibling)c=b.endContainer.lastChild;else if(b.startContainer.length==b.startOffset&&b.endOffset==0&&b.startContainer.nextSibling==b.endContainer.previousSibling)c=b.startContainer.nextSibling;if(!c||c.tagName!="IMG")c=null}else if(b.length&&b.item(0).tagName=="IMG")c=b.item(0);if(c&&"IMG"==c.nodeName){e.url.value=c.getAttribute("src");e.width.value=c.width;e.height.value=c.height;e.border.value=c.border;e.alt.value=c.alt;d.__selectOption(e.align,c.align)}e.url.focus()}},insertface:{text:"\u8868\u60c5",click:function(d,h){var c=a.find(d.objId+"InsertFace");if(null==c){for(var e,f='<div class="eFace">',b=1;b<=d.config.faceCount;b++)f+='<img src="'+a.url+"face/"+b+'.gif" emot="'+b+'" />';f+="</div>";c=a.CE("DIV",d.objId+"InsertFace",f,true);c.className="ePopPanel";a._noSel(c);a.listenTags(c,"IMG","click",function(){a.hidePop();d.insertHtml('<img align=absMiddle src="'+this.getAttribute("src")+'" emot="'+this.getAttribute("emot")+'" />')});if(g){e=a._tags(c,"IMG");for(b=e.length-1;b>=0;b--)d._ieMouseStyle(e[b],"","imgHover","")}}a.pop(c,h)}},insertflash:{text:"\u63d2\u5165Flash",click:function(b,f){var c=a.find(b.objId+"InsertFlash"),d;if(null==c){var e=function(){a.hidePop();var c=this.form.elements;b.insertFlash(c.url.value,c.width.value,c.height.value);return false};c=b._popFormUI(b.objId+"InsertFlash",G,z,e,["width","height"],b.config.flashUploadUrl,b.config.flashFileTypes,b.config.flashFileSize,"flash");a.drag(c)}if(!a.pop(c,f))return;d=a._tags(c,"FORM")[0];d.reset();d.elements.url.focus()}},insertmusic:{text:"\u63d2\u5165\u97f3\u9891",click:function(b,f){var c=a.find(b.objId+"InsertMusic"),d;if(null==c){var e=function(){a.hidePop();var c=this.form.elements;b.insertMusic(c.url.value,c.auto_start.value);return false};c=b._popFormUI(b.objId+"InsertMusic",I,B,e,null,b.config.musicUploadUrl,b.config.musicFileTypes,b.config.musicFileSize,"music");a.drag(c)}if(!a.pop(c,f))return;d=a._tags(c,"FORM")[0];d.reset();d.elements.url.focus()}},insertvideo:{text:"\u63d2\u5165\u89c6\u9891",click:function(b,f){var c=a.find(b.objId+"InsertVideo"),d;if(null==c){var e=function(){a.hidePop();var c=this.form.elements;b.insertVideo(c.url.value,c.auto_start.value,c.width.value,c.height.value,c.video_type.value);return false};c=b._popFormUI(b.objId+"InsertVideo",J,C,e,["width","height"],b.config.videoUploadUrl,b.config.videoFileTypes,b.config.videoFileSize,"video");a.drag(c)}if(!a.pop(c,f))return;d=a._tags(c,"FORM")[0];d.reset();d.elements.url.focus()}},cleanword:{text:"\u6e05\u7406Word\u4ee3\u7801",click:function(b){a.hidePop();b.cleanWord(true)}},typeset:{text:"\u81ea\u52a8\u6392\u7248",click:function(b){a.hidePop();b.typeset()}},mode:{text:"\u67e5\u770b\u6e90\u7801",click:function(b){a.hidePop();b.changeMode()}},splitpage:{text:"\u63d2\u5165\u5206\u9875\u7b26",click:function(b){a.hidePop();b.insertHtml(b.config.tplSplitPage)}},group:{text:"",click:null},br:{text:"",click:null},separator:{text:"",click:null},fullscreen:{text:"\u5168\u5c4f",click:function(b){a.hidePop();b.fullScreen()}},toolbarmode:{text:"\u5de5\u5177\u680f\u6a21\u5f0f",click:function(b){a.hidePop();b.changeToolbarMode()}},help:{text:"\u5e2e\u52a9",click:function(c,d){var b=a.find(c.objId+"TQHelpPanel");if(null==b){b=a.CE("DIV",c.objId+"TQHelpPanel",'<form class="ePopForm" style="line-height:20px;">TQEditor<br/>'+Q+": "+v+"<br/>"+U+': <a href="http://www.e512.net" target="_blank">e512.net</a><br />'+T+': <a href="mailto:litqqs@163.com">litqqs@163.com</a><br /></form>',true);b.className="ePopPanel"}a.pop(b,d)}}};e.tqEditor=e.tqeditor=e.TQEditor=e.TQE=a;e.isIE=f;e.isIE6=g;e.IEVersion=q;e.isWebkit=n;e.isGecko=l})(window)